#include <stdlib.h>
#include <gtk/gtk.h>
#include <libwnck/libwnck.h>
#include <glib/gstdio.h>
#include <libgnome/libgnome.h>

#include "window.h"
#include "config.h"
#include "globals.h"


struct _config  config;
WnckScreen *    screen;


void init_wnck()
{
    // FIXME check return values
    screen = wnck_screen_get_default ();
    wnck_screen_force_update (screen);
}


int main (int argc, char *argv[])
{
    GtkWidget *win = NULL;


    // default values
    config.dir = config_get_dir ();
    config.launcher_label = "";
    config.launcher_size = 132;
    config.rows = 3;
    config.cols = 3;
    config.close_on_launch = TRUE;


    gnome_program_init("gtk-speed-dial", "0.2", NULL, argc, argv, NULL, NULL);

    /* Initialize GTK+ */
    g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
    gtk_init (&argc, &argv);
    g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);

//    gtk_rc_parse("/usr/share/themes/Crux/gtk-2.0/gtkrc");
    gchar *default_files[]= {"home/adisk/gtkrc", NULL};
    gtk_rc_set_default_files(default_files);
    gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);

    init_wnck();

    // read config and check settings
    config_create_dir(config.dir);

    /* Enter the main loop */
    win = window_new();

    gtk_widget_show_all (win);

    gtk_main ();

    g_free(config.dir);

    return 0;
}
